package ar.com.hc.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class HCDataBaseUtils {

	private static Logger LOGGER = LoggerFactory
			.getLogger(HCDataBaseUtils.class);

	public static Connection getConnection() throws SQLException {
		try {
			Class.forName(HCConfiguration
					.getProperty(HCConfiguration.DB_DRIVER));
		} catch (ClassNotFoundException e) {
			HCI18n.getInstance().getMessage("errors.classNotFound");
		}
		Connection con = DriverManager.getConnection(HCConfiguration
				.getProperty(HCConfiguration.DB_URL));
		return con;
	}

	public static void main(String[] args) {
		try {
			getConnection();
		} catch (SQLException e) {
			LOGGER.error(HCI18n.getInstance()
					.getMessage("errors.canNotConnect"), e);
		}
	}
}
